#include "stdafx.h"
#include"header.h"
namespace maxc
{
	namespace header
	{
		HTTPRequestHeader::HTTPRequestHeader() :requestStream(&request)
		{
		}

		_asio::streambuf & HTTPRequestHeader::ReturnRequestStream()
		{
			return request;
		}

		HTTPRequestHeader& HTTPRequestHeader::SetGetHeader(const char * path)
		{
			requestStream.flush();
			requestStream << "GET " << path << " HTTP/1.1\r\n";
			ConstructHeader();
			requestStream << "\r\n";
			return *this;
		}

		HTTPRequestHeader& HTTPRequestHeader::SetPostHeader(const char * path, const char * data)
		{
			requestStream.flush();
			requestStream << "POST " << path << " HTTP/1.1\r\n";
			ConstructHeader();
			requestStream << "\r\n";
			requestStream << data;
			return *this;
		}
	}
}